#include "mainwindow.h"
#include "ui_mainwindow.h"
#include"QMessageBox"
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    messagebox=new QMessageBox(this);
    messagebox->setText("弹窗已打开");
    messagebox->setIcon(QMessageBox::Information);
    messagebox->setStandardButtons(QMessageBox::Ok|QMessageBox::Cancel);



}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
     this->messagebox->show();
}

void MainWindow::on_pushButton_2_clicked()
{
    QColor color=QColorDialog::getColor(QColor(0,255,0),this,"选择颜色");
            char style[1024]={0};
    sprintf(style,"background-color: rgb(%d,%d,%d)",color.red(),color.green(),color.blue());
    this->setStyleSheet(style);
}
